\hypertarget{matrix_8c}{}\section{lib/matrix.c File Reference}
\label{matrix_8c}\index{lib/matrix.\+c@{lib/matrix.\+c}}


matrix functions  


{\ttfamily \#include \char`\"{}user\+\_\+config.\+h\char`\"{}}\\*
{\ttfamily \#include \char`\"{}matrix.\+h\char`\"{}}\\*
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{matrix_8c_a533fea51f46e772b14ec519a9f36aef9}{Test\+Square} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatA)
\begin{DoxyCompactList}\small\item\em Credits\+: \href{https://www.cs.rochester.edu/~brown/Crypto/assts/projects/adj.html}{\tt https\+://www.\+cs.\+rochester.\+edu/$\sim$brown/\+Crypto/assts/projects/adj.\+html}. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} \hyperlink{matrix_8c_a5595f5b7a290aaeaf2daf98858bbdac2}{Mat\+Alloc} (int rows, int cols)
\begin{DoxyCompactList}\small\item\em Allocate a matrix. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} \hyperlink{matrix_8c_ae601ec2eed7dd95254dffd0e6ac03d23}{Mat\+Alloc\+SQ} (int size)
\begin{DoxyCompactList}\small\item\em Allocate a matrix. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{matrix_8c_a2b9e8a544e7c2b04934737a30a19c6f6}{Mat\+Free} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} matF)
\begin{DoxyCompactList}\small\item\em Free a matrix. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} \hyperlink{matrix_8c_ad8c8055df2f89f410d49002690ede4cf}{Mat\+Load} (void $\ast$V, int rows, int cols)
\begin{DoxyCompactList}\small\item\em Load a matrix. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} \hyperlink{matrix_8c_ad554fcd60a6674448de06fbfc40d41d0}{Mat\+Load\+SQ} (void $\ast$V, int size)
\begin{DoxyCompactList}\small\item\em Load a square matrix. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} void \hyperlink{matrix_8c_ac950e582063e7d093f0384c5a35b6024}{Mat\+Print} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} matrix)
\begin{DoxyCompactList}\small\item\em Print a matrix. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} \hyperlink{matrix_8c_a5d91cec0176890e753207fa1b32ef505}{Delete\+Row\+Col} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatA, int row, int col)
\begin{DoxyCompactList}\small\item\em Create smaller matrix by deleatting specified row and colume Used by Minor and Cofactor. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} \hyperlink{matrix_8c_a69e8069902ef085b6c19b391f3379492}{Transpose} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatA)
\begin{DoxyCompactList}\small\item\em Transpose matrix. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} float \hyperlink{matrix_8c_a37d07d9a07bb5ed06e22ac723e7cd269}{Minor} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatA, int row, int col)
\begin{DoxyCompactList}\small\item\em Compute determinate of the minor submatrix Minor submatrix has one less row and column as a result. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} float \hyperlink{matrix_8c_aa96a1963cc354fe2a055eae3c846227c}{Cofactor} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatA, int row, int col)
\begin{DoxyCompactList}\small\item\em Cofactor is determinate of minor submatrix $\ast$ (-\/1)exp(row+col) Minor submatrix has one less row and column as a result. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} \hyperlink{matrix_8c_a5140bc12eedbf802992531ca0ef3f0a8}{Adjugate} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatA)
\begin{DoxyCompactList}\small\item\em Adjugate is transpose of cofactor matrix of A. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} float \hyperlink{matrix_8c_af4eb7f5eff3cb27e283a27c7fbb53d6a}{Determinant} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatA)
\begin{DoxyCompactList}\small\item\em Determinant by recursion using Cofactors. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} \hyperlink{matrix_8c_a7d4a273868c8ba43d51338aee9310b00}{Invert} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatA)
\begin{DoxyCompactList}\small\item\em Calculate Matrix Inverse. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} \hyperlink{matrix_8c_a2217661f847795248eb975a64539488e}{Pseudo\+Invert} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatA)
\begin{DoxyCompactList}\small\item\em Calculate Pseudo Matrix Inverse Used for least square fitting of non square matrix with excess solutions Pseudo Inverse matrix(\+A) = 1/(AT × A) × AT. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} \hyperlink{matrix_8c_a5539a20ee0f152e7f1e38d36b3dfda20}{Mat\+Mul} (\hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatA, \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatB)
\begin{DoxyCompactList}\small\item\em Multiply two matrix. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} \hyperlink{matrix_8c_ad75902878173dfc33c227a75862c9c10}{Mat\+Read} (char $\ast$name)
\begin{DoxyCompactList}\small\item\em Read a matrix. \end{DoxyCompactList}\item 
\hyperlink{earth2wireframe_8c_ad0fe97585b8891f5e4f2b9a6426330a4}{M\+E\+M\+S\+P\+A\+CE} int \hyperlink{matrix_8c_a6b1e8be5bc0c3a79a81e4254bbd8e6a5}{Mat\+Write} (char $\ast$name, \hyperlink{matrix_8h_aff180987da2be77c8864e8c906bf04e6}{mat\+\_\+t} MatW)
\begin{DoxyCompactList}\small\item\em Write a matrix. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
matrix functions 

\begin{DoxyParagraph}{Copyright \copyright{} 2016 Mike Gore, G\+PL License}

\end{DoxyParagraph}
\begin{DoxyParagraph}{You are free to use this code under the terms of G\+PL}
please retain a copy of this notice in any code you use it in.
\end{DoxyParagraph}
This is free software\+: you can redistribute it and/or modify it under the terms of the G\+NU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but W\+I\+T\+H\+O\+UT A\+NY W\+A\+R\+R\+A\+N\+TY; without even the implied warranty of M\+E\+R\+C\+H\+A\+N\+T\+A\+B\+I\+L\+I\+TY or F\+I\+T\+N\+E\+SS F\+OR A P\+A\+R\+T\+I\+C\+U\+L\+AR P\+U\+R\+P\+O\+SE. See the G\+NU General Public License for more details.

You should have received a copy of the G\+NU General Public License along with this program. If not, see \href{http://www.gnu.org/licenses/}{\tt http\+://www.\+gnu.\+org/licenses/}. 

\subsection{Function Documentation}
\index{matrix.\+c@{matrix.\+c}!Adjugate@{Adjugate}}
\index{Adjugate@{Adjugate}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Adjugate(mat\+\_\+t Mat\+A)}{Adjugate(mat_t MatA)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf mat\+\_\+t} Adjugate (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{MatA}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_a5140bc12eedbf802992531ca0ef3f0a8}{}\label{matrix_8c_a5140bc12eedbf802992531ca0ef3f0a8}


Adjugate is transpose of cofactor matrix of A. 

\begin{DoxySeeAlso}{See also}
\href{https://en.wikipedia.org/wiki/Adjugate_matrix}{\tt https\+://en.\+wikipedia.\+org/wiki/\+Adjugate\+\_\+matrix} 
\end{DoxySeeAlso}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em MatA} & matrix A \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Adjugate or A 
\end{DoxyReturn}


Definition at line 325 of file matrix.\+c.



Referenced by Invert(), and Mat\+Write().

\index{matrix.\+c@{matrix.\+c}!Cofactor@{Cofactor}}
\index{Cofactor@{Cofactor}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Cofactor(mat\+\_\+t Mat\+A, int row, int col)}{Cofactor(mat_t MatA, int row, int col)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} float Cofactor (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{MatA, }
\item[{int}]{row, }
\item[{int}]{col}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_aa96a1963cc354fe2a055eae3c846227c}{}\label{matrix_8c_aa96a1963cc354fe2a055eae3c846227c}


Cofactor is determinate of minor submatrix $\ast$ (-\/1)exp(row+col) Minor submatrix has one less row and column as a result. 

\begin{DoxySeeAlso}{See also}
\href{https://en.wikipedia.org/wiki/Cofactor}{\tt https\+://en.\+wikipedia.\+org/wiki/\+Cofactor} 
\end{DoxySeeAlso}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em MatA} & matrix A \\
\hline
\mbox{\tt in}  & {\em row} & row to delete \\
\hline
\mbox{\tt in}  & {\em col} & col to delete \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Determinate $\ast$ (-\/1)exp(row + col) 
\end{DoxyReturn}


Definition at line 310 of file matrix.\+c.



Referenced by Adjugate(), and Determinant().

\index{matrix.\+c@{matrix.\+c}!Delete\+Row\+Col@{Delete\+Row\+Col}}
\index{Delete\+Row\+Col@{Delete\+Row\+Col}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Delete\+Row\+Col(mat\+\_\+t Mat\+A, int row, int col)}{DeleteRowCol(mat_t MatA, int row, int col)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf mat\+\_\+t} Delete\+Row\+Col (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{MatA, }
\item[{int}]{row, }
\item[{int}]{col}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_a5d91cec0176890e753207fa1b32ef505}{}\label{matrix_8c_a5d91cec0176890e753207fa1b32ef505}


Create smaller matrix by deleatting specified row and colume Used by Minor and Cofactor. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em MatA} & matrix A -\/ row and col must be $>$= 2 \\
\hline
\mbox{\tt in}  & {\em row} & row to delete \\
\hline
\mbox{\tt in}  & {\em col} & col to delete \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
submatrix 
\end{DoxyReturn}


Definition at line 212 of file matrix.\+c.



Referenced by Minor().

\index{matrix.\+c@{matrix.\+c}!Determinant@{Determinant}}
\index{Determinant@{Determinant}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Determinant(mat\+\_\+t Mat\+A)}{Determinant(mat_t MatA)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} float Determinant (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{MatA}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_af4eb7f5eff3cb27e283a27c7fbb53d6a}{}\label{matrix_8c_af4eb7f5eff3cb27e283a27c7fbb53d6a}


Determinant by recursion using Cofactors. 

\begin{DoxySeeAlso}{See also}
\href{https://en.wikipedia.org/wiki/Determinant}{\tt https\+://en.\+wikipedia.\+org/wiki/\+Determinant} 
\end{DoxySeeAlso}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em MatA} & square matrix A \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Determinant or 0 
\end{DoxyReturn}


Definition at line 350 of file matrix.\+c.



Referenced by Invert(), and Minor().

\index{matrix.\+c@{matrix.\+c}!Invert@{Invert}}
\index{Invert@{Invert}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Invert(mat\+\_\+t Mat\+A)}{Invert(mat_t MatA)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf mat\+\_\+t} Invert (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{MatA}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_a7d4a273868c8ba43d51338aee9310b00}{}\label{matrix_8c_a7d4a273868c8ba43d51338aee9310b00}


Calculate Matrix Inverse. 

\begin{DoxySeeAlso}{See also}
\href{https://en.wikipedia.org/wiki/Invertible_matrix}{\tt https\+://en.\+wikipedia.\+org/wiki/\+Invertible\+\_\+matrix} Method used\+: Adjugate(\+Mat\+A) / Det(\+Mat\+A) 
\end{DoxySeeAlso}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em MatA} & square matrix A input \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Inverse of MatA or error 
\end{DoxyReturn}


Definition at line 399 of file matrix.\+c.



Referenced by Mat\+Write(), and Pseudo\+Invert().

\index{matrix.\+c@{matrix.\+c}!Mat\+Alloc@{Mat\+Alloc}}
\index{Mat\+Alloc@{Mat\+Alloc}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Mat\+Alloc(int rows, int cols)}{MatAlloc(int rows, int cols)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf mat\+\_\+t} Mat\+Alloc (
\begin{DoxyParamCaption}
\item[{int}]{rows, }
\item[{int}]{cols}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_a5595f5b7a290aaeaf2daf98858bbdac2}{}\label{matrix_8c_a5595f5b7a290aaeaf2daf98858bbdac2}


Allocate a matrix. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em size} & size of square matrix to allocate \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
float $\ast$$\ast$ 
\end{DoxyReturn}


Definition at line 48 of file matrix.\+c.



Referenced by Adjugate(), Delete\+Row\+Col(), Mat\+Alloc\+S\+Q(), Mat\+Load(), Mat\+Mul(), Mat\+Read(), and Transpose().

\index{matrix.\+c@{matrix.\+c}!Mat\+Alloc\+SQ@{Mat\+Alloc\+SQ}}
\index{Mat\+Alloc\+SQ@{Mat\+Alloc\+SQ}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Mat\+Alloc\+S\+Q(int size)}{MatAllocSQ(int size)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf mat\+\_\+t} Mat\+Alloc\+SQ (
\begin{DoxyParamCaption}
\item[{int}]{size}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_ae601ec2eed7dd95254dffd0e6ac03d23}{}\label{matrix_8c_ae601ec2eed7dd95254dffd0e6ac03d23}


Allocate a matrix. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em size} & size of square matrix to allocate \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
float $\ast$$\ast$ 
\end{DoxyReturn}


Definition at line 105 of file matrix.\+c.

\index{matrix.\+c@{matrix.\+c}!Mat\+Free@{Mat\+Free}}
\index{Mat\+Free@{Mat\+Free}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Mat\+Free(mat\+\_\+t mat\+F)}{MatFree(mat_t matF)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void Mat\+Free (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{matF}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_a2b9e8a544e7c2b04934737a30a19c6f6}{}\label{matrix_8c_a2b9e8a544e7c2b04934737a30a19c6f6}


Free a matrix. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$$\ast$\+Mat} & Matrix to free \\
\hline
\end{DoxyParams}


Definition at line 116 of file matrix.\+c.



Referenced by Mat\+Alloc(), Mat\+Read(), Mat\+Write(), Minor(), and Pseudo\+Invert().

\index{matrix.\+c@{matrix.\+c}!Mat\+Load@{Mat\+Load}}
\index{Mat\+Load@{Mat\+Load}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Mat\+Load(void $\ast$\+V, int rows, int cols)}{MatLoad(void *V, int rows, int cols)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf mat\+\_\+t} Mat\+Load (
\begin{DoxyParamCaption}
\item[{void $\ast$}]{V, }
\item[{int}]{rows, }
\item[{int}]{cols}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_ad8c8055df2f89f410d49002690ede4cf}{}\label{matrix_8c_ad8c8055df2f89f410d49002690ede4cf}


Load a matrix. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$V} & matrix data \\
\hline
\mbox{\tt in}  & {\em size} & size of square matrix \\
\hline
\end{DoxyParams}


Definition at line 152 of file matrix.\+c.



Referenced by Mat\+Load\+S\+Q(), and Mat\+Write().

\index{matrix.\+c@{matrix.\+c}!Mat\+Load\+SQ@{Mat\+Load\+SQ}}
\index{Mat\+Load\+SQ@{Mat\+Load\+SQ}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Mat\+Load\+S\+Q(void $\ast$\+V, int size)}{MatLoadSQ(void *V, int size)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf mat\+\_\+t} Mat\+Load\+SQ (
\begin{DoxyParamCaption}
\item[{void $\ast$}]{V, }
\item[{int}]{size}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_ad554fcd60a6674448de06fbfc40d41d0}{}\label{matrix_8c_ad554fcd60a6674448de06fbfc40d41d0}


Load a square matrix. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$V} & square matrix data \\
\hline
\mbox{\tt in}  & {\em size} & size of square matrix \\
\hline
\end{DoxyParams}


Definition at line 176 of file matrix.\+c.



Referenced by Mat\+Write().

\index{matrix.\+c@{matrix.\+c}!Mat\+Mul@{Mat\+Mul}}
\index{Mat\+Mul@{Mat\+Mul}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Mat\+Mul(mat\+\_\+t Mat\+A, mat\+\_\+t Mat\+B)}{MatMul(mat_t MatA, mat_t MatB)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf mat\+\_\+t} Mat\+Mul (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{MatA, }
\item[{{\bf mat\+\_\+t}}]{MatB}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_a5539a20ee0f152e7f1e38d36b3dfda20}{}\label{matrix_8c_a5539a20ee0f152e7f1e38d36b3dfda20}


Multiply two matrix. 

\begin{DoxySeeAlso}{See also}
\href{https://en.wikipedia.org/wiki/Matrix_multiplication_algorithm}{\tt https\+://en.\+wikipedia.\+org/wiki/\+Matrix\+\_\+multiplication\+\_\+algorithm} C = AB, A is n × m matrix, B is m × p matrix C result n × p matrix (dimensions row size of A, column size of B) Cij = Sum(k=1 .. m) Aik $\ast$ Bik 
\end{DoxySeeAlso}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em MatA} & matrix A \\
\hline
\mbox{\tt in}  & {\em MatB} & matrix B \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
MatA $\ast$ MatB Result dimensions is (row size of A, column size of B) 
\end{DoxyReturn}


Definition at line 490 of file matrix.\+c.



Referenced by Mat\+Write(), and Pseudo\+Invert().

\index{matrix.\+c@{matrix.\+c}!Mat\+Print@{Mat\+Print}}
\index{Mat\+Print@{Mat\+Print}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Mat\+Print(mat\+\_\+t matrix)}{MatPrint(mat_t matrix)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} void Mat\+Print (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{matrix}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_ac950e582063e7d093f0384c5a35b6024}{}\label{matrix_8c_ac950e582063e7d093f0384c5a35b6024}


Print a matrix. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em Mat} & Matrix to print \\
\hline
\end{DoxyParams}


Definition at line 187 of file matrix.\+c.



Referenced by Invert(), and Mat\+Write().

\index{matrix.\+c@{matrix.\+c}!Mat\+Read@{Mat\+Read}}
\index{Mat\+Read@{Mat\+Read}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Mat\+Read(char $\ast$name)}{MatRead(char *name)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf mat\+\_\+t} Mat\+Read (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_ad75902878173dfc33c227a75862c9c10}{}\label{matrix_8c_ad75902878173dfc33c227a75862c9c10}


Read a matrix. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$name} & matrix data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
mat\+\_\+t matrix data Note\+: on error rows and cols = 0, data = N\+U\+LL; 
\end{DoxyReturn}


Definition at line 527 of file matrix.\+c.



Referenced by setup().

\index{matrix.\+c@{matrix.\+c}!Mat\+Write@{Mat\+Write}}
\index{Mat\+Write@{Mat\+Write}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Mat\+Write(char $\ast$name, mat\+\_\+t Mat\+W)}{MatWrite(char *name, mat_t MatW)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int Mat\+Write (
\begin{DoxyParamCaption}
\item[{char $\ast$}]{name, }
\item[{{\bf mat\+\_\+t}}]{MatW}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_a6b1e8be5bc0c3a79a81e4254bbd8e6a5}{}\label{matrix_8c_a6b1e8be5bc0c3a79a81e4254bbd8e6a5}


Write a matrix. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em $\ast$name} & matrix data \\
\hline
\mbox{\tt in}  & {\em MatW} & Matrix \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
status 1 = success, 0 = fail 
\end{DoxyReturn}


Definition at line 605 of file matrix.\+c.



Referenced by user\+\_\+tests().

\index{matrix.\+c@{matrix.\+c}!Minor@{Minor}}
\index{Minor@{Minor}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Minor(mat\+\_\+t Mat\+A, int row, int col)}{Minor(mat_t MatA, int row, int col)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} float Minor (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{MatA, }
\item[{int}]{row, }
\item[{int}]{col}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_a37d07d9a07bb5ed06e22ac723e7cd269}{}\label{matrix_8c_a37d07d9a07bb5ed06e22ac723e7cd269}


Compute determinate of the minor submatrix Minor submatrix has one less row and column as a result. 

\begin{DoxySeeAlso}{See also}
\href{https://en.wikipedia.org/wiki/Minor_(linear_algebra)}{\tt https\+://en.\+wikipedia.\+org/wiki/\+Minor\+\_\+(linear\+\_\+algebra)} 
\end{DoxySeeAlso}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em MatA} & matrix A \\
\hline
\mbox{\tt in}  & {\em row} & row to delete \\
\hline
\mbox{\tt in}  & {\em col} & col to delete \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Determinate 
\end{DoxyReturn}


Definition at line 291 of file matrix.\+c.



Referenced by Cofactor().

\index{matrix.\+c@{matrix.\+c}!Pseudo\+Invert@{Pseudo\+Invert}}
\index{Pseudo\+Invert@{Pseudo\+Invert}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Pseudo\+Invert(mat\+\_\+t Mat\+A)}{PseudoInvert(mat_t MatA)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf mat\+\_\+t} Pseudo\+Invert (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{MatA}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_a2217661f847795248eb975a64539488e}{}\label{matrix_8c_a2217661f847795248eb975a64539488e}


Calculate Pseudo Matrix Inverse Used for least square fitting of non square matrix with excess solutions Pseudo Inverse matrix(\+A) = 1/(AT × A) × AT. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em MatA} & matrix A input -\/ does not have to be square \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Pseudo Inverse of MatA or error 
\end{DoxyReturn}


Definition at line 456 of file matrix.\+c.



Referenced by Mat\+Write().

\index{matrix.\+c@{matrix.\+c}!Test\+Square@{Test\+Square}}
\index{Test\+Square@{Test\+Square}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Test\+Square(mat\+\_\+t Mat\+A)}{TestSquare(mat_t MatA)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} int Test\+Square (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{MatA}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_a533fea51f46e772b14ec519a9f36aef9}{}\label{matrix_8c_a533fea51f46e772b14ec519a9f36aef9}


Credits\+: \href{https://www.cs.rochester.edu/~brown/Crypto/assts/projects/adj.html}{\tt https\+://www.\+cs.\+rochester.\+edu/$\sim$brown/\+Crypto/assts/projects/adj.\+html}. 

\begin{DoxyAuthor}{Author}
Paul Bourke 2002 Test is a matrix is square 
\end{DoxyAuthor}

\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em MatA} & matrix A \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1 if ssquare, 0 if not 
\end{DoxyReturn}


Definition at line 37 of file matrix.\+c.

\index{matrix.\+c@{matrix.\+c}!Transpose@{Transpose}}
\index{Transpose@{Transpose}!matrix.\+c@{matrix.\+c}}
\subsubsection[{\texorpdfstring{Transpose(mat\+\_\+t Mat\+A)}{Transpose(mat_t MatA)}}]{\setlength{\rightskip}{0pt plus 5cm}{\bf M\+E\+M\+S\+P\+A\+CE} {\bf mat\+\_\+t} Transpose (
\begin{DoxyParamCaption}
\item[{{\bf mat\+\_\+t}}]{MatA}
\end{DoxyParamCaption}
)}\hypertarget{matrix_8c_a69e8069902ef085b6c19b391f3379492}{}\label{matrix_8c_a69e8069902ef085b6c19b391f3379492}


Transpose matrix. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em MatA} & matrix A \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Transpose matrix 
\end{DoxyReturn}


Definition at line 263 of file matrix.\+c.



Referenced by Pseudo\+Invert().

